package io.gitee.yeningx.example.controller;

import io.gitee.yeningx.example.converter.Page1;
import io.gitee.yeningx.tools.web.IgnoreWrapper;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/test")
public class Hello1Controller {
    /**
     * 默认进行封装
     *
     * @return
     */
    @RequestMapping("/hello")
    public String hello() {
        return "hello1";
    }

    /**
     * 自定义类型转换
     * @return
     */
    @RequestMapping("/hello2")
    public Page1 hello2(){
        Page1 p1 = new Page1();
        p1.setPageSize(10);
        p1.setPageNum(9);
        p1.setDataList(List.of("a", "b"));
        return p1;
    }

    /**
     * 方法级忽略封装
     *
     * @return
     */
    @IgnoreWrapper
    @RequestMapping("/hello3")
    public String hello3() {
        return "hello3";
    }
}
